/*************************************************
filename	: win32_system_gadget.h
author		: Stefan lulham
desc		: Contains win32 system gadget interface
*************************************************/
#ifndef D_WIN32_SYSTEM_GADGET_H
#define D_WIN32_SYSTEM_GADGET_H

#include <Windows.h>
#include <string>
#include <iostream>
#include <managers\event\event_manager.h>
#include <modules\system\system_enums.h>

#ifndef MAPVK_VK_TO_VSC
   #define MAPVK_VK_TO_VSC 0
#endif

using namespace DelGE::Managers::Event;
using namespace std;

namespace DelGE
{
	namespace Modules
	{
		namespace System
		{
			class Win32SystemGadget
			{
			protected:
				DelGESystemGadgetType eGadgetType;

				HWND hWnd;
				HDC hDC;

				bool bIsMouseInside;
				bool bHasFocus;

				int iWidth, iHeight;

			public:
				Win32SystemGadget();
				Win32SystemGadget(HWND hWNd);
				~Win32SystemGadget();

				void SetSize(int iWidth, int iHeight);
				void SetWidth(int iWidth);
				void SetHeight(int iHeight);
				int GetWidth();
				int GetHeight();
				void SetPosition(int iX, int iY);
				void SetPositionX(int iX);
				void SetPositionY(int iY);
				int GetPositionX();
				int GetPositionY();
				int GetClientPositionX();
				int GetClientPositionY();

				bool IsMouseInside();
				bool HasFocus();
				void SetFocus();

				int ScreenPositionXToClientPositionX(int iScreenPositionX);
				int ScreenPositionYToClientPositionY(int iScreenPositionY);

				int ClientPositionXToScreenPositionX(int iWindowPositionX);
				int ClientPositionYToScreenPositionY(int iWindowPositionY);

				HWND GetHWND();
				HDC GetHDC();

				DelGESystemGadgetType GetGadgetType();

				KeyCode ConvertVirtualKeyCode(WPARAM wParam, LPARAM lParam);
				void ProcessEvent(UINT msg, WPARAM wParam, LPARAM lParam);
			};
		}
	}
}

#endif
